package com.xian.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: xlr
 * @Date: Created in 下午11:07 2019/1/7
 */
@RestController
@RequestMapping
public class TestController {

    @Autowired
    JdbcTemplate jdbcTemplate;

   @RequestMapping(value = "mytest",method = RequestMethod.GET)
    public String sss(){
       String name = jdbcTemplate.queryForObject( "SELECT name FROM user WHERE id = 1", String.class );
       return "Welcome " + name;
    }
}
